package com.ls.day12;

public class Divide {

    public static void main(String[] args) {
        System.out.println(divide(-2147483648,-1));
    }

    public static int divide(int dividend, int divisor) {
        if (dividend==Integer.MIN_VALUE && divisor==-1)return Integer.MAX_VALUE;
        if (Math.abs(dividend)<Math.abs(divisor) || dividend==0)return 0;
        int flag=1;
        if (dividend>0&& divisor<0 || dividend<0&& divisor>0)flag=-1;
        int res=0,ds = Math.abs(divisor),dd = Math.abs(dividend);
        while (Math.abs(dd-ds)>=divisor){

        }
        return res*flag;
    }
}
